# 模型评估
evaluator = ModelEvaluator(trained_model, X_test, y_test)
metrics = evaluator.full_evaluation()
print(f"误报率: {metrics['false_positive_rate']:.4f}")
print(f"漏报率: {metrics['false_negative_rate']:.4f}")

# 模型优化
optimizer = ModelOptimizer(
    RandomForestClassifier(),
    {'class_weight': [{0:1,1:3}, {0:1,1:5}], 'max_depth': [10, 20]}
)
optimized_model = optimizer.optimize_for_security(X_train, y_train)

# 阈值优化
threshold_optimizer = ThresholdOptimizer(optimized_model, X_val, y_val)
best_threshold = threshold_optimizer.find_optimal_threshold() 